package com.xu.packes.segregation;

/**
 * @version v1.0
 * @类描述：
 * @项目名称：
 * @包名： com.xu.packes.segregation
 * @类名称：SegregationMain
 * @创建人：YIHANG.XU
 * @创建时间：2021/3/710:54 上午
 * @修改人：YIHANG.XU
 * @修改时间：2021/3/710:54 上午
 * @修改备注：
 * @Copyright
 */
public class SegregationMain {
    public static void main(String[] args) {
        A a = new A();
        a.depent1(new B());
        a.depent2(new B());
        a.depent3(new B());
        C c = new C();
        c.depent1(new D());
        c.depent2(new D());
        c.depent3(new D());
    }


}

interface Interface1 {
    void show1();

}

interface Interface2 {
    void show2();

    void show3();
}

interface Interface3 {
    void show4();

    void show5();

}

class B implements Interface1,Interface2 {

    @Override
    public void show1() {
        System.out.println("B实现接口方法1");
    }

    @Override
    public void show2() {
        System.out.println("B实现接口方法2");
    }

    @Override
    public void show3() {
        System.out.println("B实现接口方法3");
    }
}
class D implements Interface1,Interface3{

    @Override
    public void show1() {
        System.out.println("D实现接口方法1");
    }

    @Override
    public void show4() {
        System.out.println("D实现接口方法4");
    }

    @Override
    public void show5() {
        System.out.println("D实现接口方法5");
    }
}
class A{
    public void depent1(Interface1 interface1){
         interface1.show1();
    }
    public void depent2(Interface2 interface2){
        interface2.show2();
    }
    public void depent3(Interface2 interface2){
        interface2.show3();
    }
}
class C{
    public void depent1(Interface1 interface1){
        interface1.show1();
    }
    public void depent2(Interface3 interface3){
        interface3.show4();
    }
    public void depent3(Interface3 interface3){
        interface3.show5();
    }
}